PRO COMPARE_BT12
  
  COMMON CUBE_BLOCK, ff_cube, ff_astr, ff_dist
  ;; If the FFORE data cube (l,b,d) is not loaded into the COMMON
  ;;   block, do so now...
  IF total(size(ff_cube)) EQ 0 THEN omni_load_ffore
  
  readcol,'./ancillary/BT12_clouds.txt',desig,name,l,b,d,i_mir,fbt12,fbt09,$
          format='a,a,f,f,f,x,x,x,f,f,f'
  
  restore,'./ancillary/s06bt12_data.sav',/ver
  
  n = n_elements(desig)
  defsysv, '!MW', exists = exists
  IF NOT exists THEN galactic_params 
  alpha = flux2tau_bgps(20.d)
  
  restore,'./emaf_paper/bgps_emaf.sav',/ver
  restore,'./emaf_paper/save_files/morph_distances.sav',/ver
  
  
  openw,lun,'./emaf_paper/compare_bt12.tex',/get_lun
  
  printf,lun,'\begin{deluxetable}{lccccccccccccccccccc}'
  printf,lun,'  \tablecolumns{20}'
  printf,lun,'  \tablewidth{0pc}'
  printf,lun,'  \tabletypesize{\scriptsize}'
  printf,lun,'  \rotate'
  printf,lun,'  \tablecaption{Comparison sample to \citet{Butler:2012}\label{table:compare_bt12}}'
  printf,lun,'  \tablehead{'
  printf,lun,'    \multicolumn{5}{c}{From BT12} & \colhead{} & '
  printf,lun,'    \multicolumn{6}{c}{Present Work} & \colhead{} & '
  printf,lun,'    \multicolumn{3}{c}{$I_{MIR}$} & \colhead{} & \multicolumn{3}{c}{\ffore} \\'
  printf,lun,'    \cline{1-5} \cline{7-12} \cline{14-16} \cline{18-20}'
  printf,lun,'    \colhead{Cloud Name} & \colhead{$\ell$} & \colhead{$b$} & \colhead{$d$} & \colhead{MajAxis} &'
  printf,lun,'    \colhead{} & \colhead{CNUM} & \colhead{$\ell$} & \colhead{$b$} &'
  printf,lun,'    \colhead{$d_\mathrm{fit}$\tablenotemark{\ddag}} & \colhead{sep\tablenotemark{**}} & \colhead{\fdata} & '
  printf,lun,'    \colhead{} & \colhead{BT12} & '
  printf,lun,'    \colhead{P.W.} & \colhead{ratio\tablenotemark{\dag}} & \colhead{} & \colhead{BT09} & \colhead{BT12} & '
  printf,lun,'    \colhead{P.W.\tablenotemark{*}} \\'
  printf,lun,'    \colhead{} & \colhead{(\degr)} & \colhead{(\degr)} & \colhead{(kpc)} & \colhead{(\arcmin)} &'
  printf,lun,'    \colhead{} & \colhead{} & \colhead{(\degr)} & \colhead{(\degr)} & '
  printf,lun,'    \colhead{(kpc)} & \colhead{(\arcmin)} & \colhead{} & \colhead{} & '
  printf,lun,'    \multicolumn{2}{c}{(MJy/sr)}'
  printf,lun,'  }'
  printf,lun,'  \startdata'
  
  
  
  
  FOR i=0L, n-1 DO BEGIN
     
     gcirc,2,l[i],b[i],emaf.l,emaf.b,dis
     
     mind = min(dis)/60.
     IF mind LT 10. THEN BEGIN
        
        ind = WHERE(dis EQ mind*60., nind)
        r = emaf[ind]
        fmeas = 1. - r.c / (1. - exp(-alpha*r.s40))
        
        ;; Work the FFORE MAGIC!
        
        ad2xy,r.l,r.b,ff_astr,xi,yi
        ff = (ff_cube[xi,yi,*]) < 1.0
        ffore = interpol(ff,ff_dist,dml[ind,0]*1.d3) < 1.0

        str = desig[i]+' ('+name[i]+') & '+string(l[i],format="(F0.3)")+' & '+$
              string(b[i],format="(F0.3)")+' & '+$
              string(d[i],format="(F0.1)")+' & '+$
              string(s06bt12[i].majaxis,format="(F0.1)")+' & '
        str2 = string(r.cnum,r.l,r.b,dml[ind,0],mind,fmeas,format=$
                      "(I04,' & ',F0.3,' & ',F0.3,' & ',F0.1,' & '"+$
                      ",F0.2,' & ',F0.3,' & ')")
        str3 = string(i_mir[i],r.i_mir,r.i_mir/i_mir[i],format=$
                    "(F0.1,' & ',F0.1,' & ',F0.2,' & ')")
        str4 = string(fbt09[i],fbt12[i],ffore,format=$
                      "(F0.3,' & ',F0.3,' & ',F0.3)")
        
        str = str+' & '+str2+' & '+str3+' & '+str4+' \\'
        printf,lun,str
        
        print,desig[i],mind,emaf[ind].cnum
        
     ENDIF
     
  ENDFOR
  
  
  printf,lun,'  \enddata'
  printf,lun,'\tablenotetext{\dag}{Ratio of $I_{MIR}$ estimated for the present work over the value presented in BT12.}'
  printf,lun,'\tablenotetext{*}{Calculated using the best-fit Galactic model and the distance reported in BT12.}'
  printf,lun,'\tablenotetext{\ddag}{Distances from BT12 derived from \citet{Clemens:1985} rotation curve, whereas distances in the present work are from the \citet{Reid:2009} curve.}'
  printf,lun,'\tablenotetext{**}{Angular separation between the location of the IRDC center as reported in BT12 and the location of the Bolocat source.}'
  printf,lun,'\end{deluxetable}'
  
  close,lun
  free_lun,lun
  
  
END
